home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer 2.0
/
Internet Surfer 2.0 (Wayzata Technology) (1996).iso
/
pc
/
text
/
mac
/
faqs.260
< prev
next >
Wrap
Lisp/Scheme
|
1996-02-12
|
29KB
|
705 lines
Frequently Asked Questions (FAQS);faqs.260
Xref: bloom-picayune.mit.edu gnu.emacs.help:7400 comp.emacs:15249 news.answers:3114
Path: bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!eff!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!news.bbn.com!bu.edu!bigbird!jbw
From: jbw@bigbird.bu.edu (Joe Wells)
Newsgroups: gnu.emacs.help,comp.emacs,news.answers
Subject: GNU Emacs FAQ (2/5, 28-86): Common Requests/Problems
Summary: READ BEFORE POSTING. A regularly posted list of answers to frequently
asked questions (FAQs) about GNU Emacs and many Emacs Lisp programs.
Contains pointers to other resources. Follow "References:" link for
more metainfo.
Keywords: gnu emacs faq answers frequently asked questions periodic
Message-ID: <GNU-Emacs-FAQ-2.1992.09.22.011020@bigbird.bu.edu>
Date: 22 Sep 92 01:10:20 GMT
Expires: 21 Nov 92 01:10:20 GMT
References: <GNU-Emacs-FAQ-0.1992.09.22.011020@bigbird.bu.edu>
Sender: news@bu.edu
Reply-To: gnu-emacs-faq-maintainers@bigbird.bu.edu
Followup-To: poster
Organization: GNU's Not UNIX
Lines: 1133
Approved: news-answers-request@mit.edu
Supersedes: <GNU-Emacs-FAQ-2.1992.06.28.234430@bigbird.bu.edu>
Archive-Name: GNU-Emacs-FAQ/part2
Last-Modified: Mon, 21 Sep 1992 03:14:22 GMT
Last-Posted: Tue, 22 Sep 1992 01:10:20 GMT
GNU Emacs FAQ: Common Requests/Problems
If you are viewing this text in a GNU Emacs Buffer, you can type "M-2 C-x $" to
get an overview of just the questions. Then, when you want to look at the text
of the answers, just type "C-x $".
To search for a question numbered XXX, type "M-C-s ^XXX:", followed by a C-r if
that doesn't work, then type ESC to end the search.
A `+' in the 78th column means something was inserted on the line. A `-' means
something was deleted and a `!' means some combination of insertions and
deletions occurred.
Full instructions for getting the latest FAQ are in question 22. Also see the
`Introduction to news.answers' posting in the `news.answers' newsgroup, or send
e-mail to `mail-server@rtfm.mit.edu' with `help' on a body line, or use FTP,
WAIS, or Prospero to rtfm.mit.edu.
Common Things People Want To Do
28: How do I set up a .emacs file properly?
See `Init File' in the on-line manual.
WARNING: In general, new Emacs users should not have .emacs files, because
it causes confusing non-standard behavior. Then they send questions to
help-gnu-emacs asking why Emacs isn't behaving as documented. :-)
29: How do I debug a .emacs file?
First start Emacs with the `-q' command line option. Then, in the
*scratch* buffer, type the following:
(setq debug-on-error t) LFD
(load-file "~/.emacs") LFD
(Type LFD by pressing C-j.)
If you have an error in your .emacs file, this will invoke the debugger
when the error occurs. If you don't know how to use the debugger do
(setq stack-trace-on-error t) instead.
WARNING: this will not discover errors caused by trying to do something
that requires the terminal/window-system initialization code to have
been loaded. See question 127.
30: How do I make Emacs display the current line (or column) number?
To find out what line of the buffer you are on right now, do "M-x
what-line". Use "M-x goto-line" to go to a specific line. To find the
current column number, type "M-ESC (current-column)".
Typing "C-x l" will also tell you what line you are on, provided the
buffer isn't separated into "pages" with C-l characters. In that case, it
will only tell you what line of the current "page" you are on. WARNING:
"C-x l" gives the wrong value when point is at the beginning of a line.
There is no "correct" way to constantly display the current (or total)
line (or column) number on the mode line in Emacs 18, or to display the
line numbers next to the lines like vi can. Emacs is not a line-oriented
editor, and really has no idea what "lines" of the buffer are displayed in
the window. It would require a lot of work at the C code level to make
Emacs keep track of this. It would not be that hard to get the column
number, but it would still require changes at the C code level.
None of the vi emulation modes provide the `set number' capability of vi
(as far as I know).
Emacs 19 will probably be able to show the line number on the mode-line,
but probably very inefficiently.
People have written various kludges to display line numbers. One is
`display-line-numbers' by Wayne Mesard <wmesard@tofu.oracle.com,
Mesard@bbn.com>. Look in the Lisp Code Directory. (See question
88.)
31: How do I turn on Abbrevs by default just in mode XXX?
Put this in your .emacs file:
(condition-case ()
(read-abbrev-file nil t)
(file-error nil))
(setq XXX-mode-hook
(function
(lambda ()
(setq abbrev-mode t))))
32: How do I turn on Auto-Fill mode by default?
To turn on Auto-Fill mode just once for one buffer, use "M-x
auto-fill-mode". To turn it on for every buffer in, for example, Text
mode, do this:
(setq text-mode-hook 'turn-on-auto-fill)
If you want Auto-Fill mode on in all major modes, do this:
(setq-default auto-fill-hook 'do-auto-fill)
33: How do I make Emacs use a certain major mode for certain files?
If you want to use XXX mode for all files which end with the extension
`.YYY', this will do it for you:
(setq auto-mode-alist (cons '("\\.YYY\\'" . XXX-mode) auto-mode-alist))
Otherwise put this somewhere in the first line of any file you want to
edit in XXX mode:
-*-XXX-*-
34: How do I search for, delete, or replace unprintable (8-bit or control)
characters?
To search for a single character that appears in the buffer as, for
example, `\237', you can type "C-s C-q 2 3 7". (This assumes the value of
search-quote-char is 17 (ie., C-q).) Searching for ALL unprintable
characters is best done with a "regexp" search. The easiest regexp to use
for the unprintable chars is the complement of the regexp for the
printable chars.
Regexp for the printable chars: [\t\n\r\f -~]
Regexp for the unprintable chars: [^\t\n\r\f -~]
To type some of these special characters in an interactive argument to
isearch-forward-regexp or re-search-forward, you need to use C-q. (`\t',
`\n', `\r', and `\f' stand respectively for TAB, LFD, RET, and C-l.) So,
to search for unprintable characters using re-search-forward:
M-x re-search-forward RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET
Using isearch-forward-regexp:
M-C-s [^ TAB RET C-q RET C-q C-l SPC -~]
To delete all unprintable characters, simply use a replace-regexp:
M-x replace-regexp RET [^ TAB C-q LFD C-q RET C-q C-l SPC -~] RET RET
Replacing is similar to the above. {I need to write the text for this
part of the answer!}
Notes:
* With isearch, you can type RET to get a quoted LFD (not a quoted RET).
* You don't need to quote TAB with either isearch or typing something in
the minibuffer.
Here are the Emacs Lisp forms of the above regexps:
;; regexp matching all printable characters:
"[\t\n\r\f -~]"
;; regexp matching all unprintable characters:
"[^\t\n\r\f -~]"
35: How can I highlight a region of text in Emacs?
There are ways to get highlighting (reverse video, inverse video) in GNU
Emacs 18.58, but either they require patching the C code of Emacs and
rebuilding, or they are slow and the highlighting disappears if you scroll
or redraw the screen and it can not follow the point. Howard Gayle's
patches for 8-bit output appear to allow highlighting (see question
^8-bit-output). Another patch for highlighting is by Kenichi Handa
<handa@etl.go.jp>. There is a patch for use with X by Andy Norman
<ange@hplb.hpl.hp.com> (and modified for 18.57 by Matthieu Herrb
<matthieu@laas.fr>), which is available for FTP: !
!
/laas.laas.fr:pub/emacs/patch-X11-18.5{5,7} !
You can highlight regions in a variety of ways in Epoch and Lucid Emacs.
GNU Emacs 19 may not be able to just temporarily highlight a region. !
Similar comments apply to displaying text in different fonts, except that
it is even harder.
36: How do I control Emacs's case-sensitivity when searching/replacing?
For searching, the value of the variable case-fold-search determines
whether they are case sensitive:
(setq case-fold-search nil) ; make searches case sensitive
(setq case-fold-search t) ; make searches case insensitive
Similarly, for replacing the variable case-replace determines whether
replacements preserve case.
To change the case sensitivity just for one major mode, use the major
mode's hook. For example:
(setq XXX-mode-hook
(function
(lambda ()
(setq case-fold-search nil))))
37: How do I make Emacs wrap words for me?
M-x auto-fill-mode. The default maximum line width is 74, determined by
the variable fill-column. To find how to turn this on automatically see
question 32.
38: Where can I get a better spelling checker for Emacs?
Use Ispell. See question 119.
39: How can I spell-check TeX or *roff documents?
If you want to spell-check TeX or *roff documents with Ispell, you need to
arrange for a filter program that understands how to strip TeX or *roff
formatting commands to be run. In the TeX distribution, there are several
different programs named `detex', all with incompatible options, and a
very old pair of programs named `detex' and `delatex', which should
probably be avoided. The most useful one for Ispell is `detex' by Daniel
Trinkle. A more recent version is available via FTP: !
!
/arthur.cs.purdue.edu:pub/trinkle/detex-2.3.tar.Z !
Raphael Cerf <cerf@clipper.ens.fr> recently released a program for this +
named `xetal': !
!
/spi.ens.fr:pub/unix/tex/ !
There is a program that comes with Unix named `deroff' for stripping
formatting commands from *roff files.
Here is an example of code you can put in a .emacs file to use these
programs:
;; Based on suggestions by David G. Grubbs <dgg@ksr.com> and Paul Palmer
;; <palmerp@math.orst.edu>.
;; Assuming the use of detex 2.3 by Daniel Trinkle:
;; -w means one word per line.
;; -n means don't expand \input or \include commands.
;; -l means force LaTeX mode.
(require 'ispell) ; for the make-variable-buffer-local statements
(setq plain-TeX-mode-hook
(function
(lambda ()
(setq ispell-filter-hook "detex")
(setq ispell-filter-hook-args '("-nw")))))
(setq LaTeX-mode-hook
(function
(lambda ()
(setq ispell-filter-hook "detex")
(setq ispell-filter-hook-args '("-lnw")))))
(setq nroff-mode-hook
(function
(lambda ()
(setq ispell-filter-hook "deroff")
(setq ispell-filter-hook-args '("-w")))))
You will have to adjust the arguments for programs other than Trinkle's
detex or for other versions of deroff. Experiment running the command
from the shell to find the correct options. If you don't have a filter
that knows how to output one word per line, you must pipe its output
through another filter to break up the output.
40: How do I change load-path?
In general, you should only *add* to the load-path. You can add
directory /XXX/YYY to the load path like this:
(setq load-path (append load-path '("/XXX/YYY/")))
To do this relative to your home directory:
(setq load-path (append load-path (list (expand-file-name "~/YYY/"))))
41: How do I use an already running Emacs from another window?
The `emacsclient' program is for editing a file using an already running
Emacs rather than starting up a new Emacs. It does this by sending a
request to the already running Emacs, which must be expecting the request.
* Setup
Emacs must have executed the `server-start' function for emacsclient to
work. This can be done either by a command line option:
emacs -f server-start
or by invoking server-start from the .emacs file:
(if (some conditions are met) (server-start))
When this is done, Emacs starts a subprocess running a program called
`server'. `server' creates a Unix domain socket in the user's home
directory named `.emacs_server'.
To get your news reader, mail reader, etc., to invoke emacsclient, try
setting the environment variable EDITOR (or sometimes VISUAL) to the
value `emacsclient'. You may have to specify the full pathname of the
emacsclient program instead. Examples:
# csh commands:
setenv EDITOR emacsclient
setenv EDITOR /usr/local/emacs/etc/emacsclient # using full pathname
# sh command:
EDITOR=emacsclient export EDITOR
* Normal use
When emacsclient is run, it connects to the `.emacs_server' socket and
passes its command line options to `server'. When `server' receives
these requests, it sends this information on the the Emacs process,
which at the next opportunity will visit the files specified. (Line
numbers can be specified just like with Emacs.) The user will have to
switch to the Emacs window by hand. When the user is done editing a
file, the user can type "C-x #" to indicate this. This will switch to
another buffer created at the request of emacsclient if there are any.
When "C-x #" has been invoked on all of the files that the emacsclient
requested to be edited, Emacs will send notification of this to `server'
which will pass this on to the emacsclient, which will then exit.
NOTE: `emacsclient' and `server' must be running on machines which share
the same filesystem for this to work. The pathnames that emacsclient
specifies should be correct for the filesystem that the Emacs process
sees. The Emacs process should not be suspended at the time emacsclient
is invoked. emacsclient should either be invoked from another X window or
from a shell window inside Emacs itself.
There is an enhanced version of emacsclient/server called `gnuserv' by
Andy Norman <ange@hplb.hpl.hp.com> which is available in the Emacs Lisp
Archive. gnuserv uses Internet domain sockets, so it can work across most
network connections. It also supports the execution of arbitrary Emacs
Lisp forms and also does not require the client program to wait for
completion. It is available via anonymous FTP (Emacs Lisp Archive:
packages/gnuserv.shar).
42: How do I make Emacs recognize my compiler's funny error messages?
Write a program which runs the compiler as a child and filters its output,
rearranging as necessary. Install with same name as compiler somewhere in
path.
Keith Moore <moore@cs.utk.edu> wrote one such for a C compiler under AIX.
Available via FTP: !
!
/cs.utk.edu:readonly/aixcc.lex !
Jim Frost <jimf@saber.com> wrote another for the IBM xlc compiler on the
RS/6000. (I don't know if these are both for the same compiler.)
Johnathan Vail <vail@tegra.COM> wrote something for a High C compiler
(`hc', which is one of the compilers on the RS/6000, although I think
Johnathan wrote his program for hc on a different computer).
43: How do I indent switch statements like this?
Many people want to indent their switch statements like this:
f()
{
switch(x) {
case A:
x1;
break;
case B:
x2;
break;
default:
x3;
}
}
I don't believe there is any way to do this exactly without modifying the
Lisp code in c-mode.el. You can set c-indent-level to 4 and
c-label-offset to -2, but this has bad effects elsewhere. {Anyone have a
solution?}
44: How can I make Emacs automatically scroll horizontally?
There is no completely correct way of doing this that does not involve !
rewriting all commands or writing your own top-level command loop (not a !
completely bad idea). Wayne Mesard <wmesard@pescadero.stanford.edu> has !
written a particularly advanced kludge called `hscroll.el' that checks !
once a second to make sure point is visible. !
45: How do I make Emacs "typeover" or "overwrite" instead of inserting?
M-x overwrite-mode (a minor mode).
46: How do I stop Emacs from beeping on a terminal?
Martin R. Frank <martin@cc.gatech.edu> writes:
Tell Emacs to use the 'visible bell' instead of the audible bell, and
set the visible bell to nothing.
Put this in your TERMCAP environment variable:
... :vb=: ...
And evaluate this:
(setq visible-bell t)
47: How do I turn down the bell volume in Emacs running under X Windows?
Under versions of Emacs before 18.58, the bell volume was annoying loud
and difficult to turn off. So upgrading to 18.58 will reduce the volume.
If you want to turn it off completely, use `xset'. There is no way to
turn the bell off just for Emacs without affecting all other programs.
Under Epoch you can do:
(setq epoch::bell-volume 20)
Stu Grossman <grossman@sunburn.stanford.edu> wrote a patch that allows the
bell volume to be adjusted from inside Emacs just for Emacs.
48: How do I tell Emacs to automatically indent a new line to the
indentation of the previous line?
One solution is Indented Text Mode (M-x indented-text-mode).
If you have Auto-Fill mode on (a minor mode, see question 32), you can
tell Emacs to prefix every line with a certain character sequence, the
"fill prefix". Type the prefix at the beginning of a line, position point
after it, and then type "C-x ." (set-fill-prefix) to set the fill prefix.
Thereafter, auto-filling will automatically put the fill prefix at the
beginning of new lines, and M-q (fill-paragraph) will maintain any fill
prefix when refilling the paragraph.
NOTE: If you have paragraphs with different levels of indentation, you
will have to set the fill prefix to the correct value each time you move
to a new paragraph. To avoid this hassle, try one of the many packages
available from the Emacs Lisp Archive. Look up `fill' and `indent' in the
Lisp Code Directory for guidance.
49: How do I show which parenthesis matches the one I'm looking at?
If you're looking at a right parenthesis (or brace or bracket) you can
delete it and reinsert it. Emacs will blink the cursor on the matching
parenthesis.
M-C-f (forward-sexp) and M-C-b (backward-sexp) will skip over balanced
parentheses, so you can see which parentheses match. (You can train it to
skip over balanced brackets and braces at the same time by modifying the
syntax table.)
Here is some Emacs Lisp that will make the % key show the matching
parenthesis, like in vi. In addition, if the cursor isn't over a
parenthesis, it simply inserts a % like normal.
;; By an unknown contributor
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
"Go to the matching parenthesis if on parenthesis otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))
50: In C mode, can I show just the lines that will be left after #ifdef
commands are handled by the compiler?
M-x hide-ifdef-mode. (This is a minor mode.)
You may have to (load "hideif") first. If you want to do this regularly,
put this in your .emacs file:
(autoload 'hide-ifdef-mode "hideif" nil t)
{Yes, I know, this should be in lisp/loaddefs.el already.}
51: Is there an equivalent to the `.' (dot) command of vi?
(`.' is the redo command in vi. It redoes the last insertion/deletion.)
No, not really.
You can type "C-x ESC" (repeat-complex-command) to reinvoke commands that
used the minibuffer to get arguments. In repeat-complex-command you can
type M-p and M-n to scan through all the different complex commands you've
typed.
To repeat something on each line I recommend using keyboard macros.
52: What are the valid X resource settings (ie., stuff in .Xdefaults)?
See the Emacs man page, or the etc/OPTIONS file. Ignore the information
in etc/XDOC which is way out of date.
53: How do I execute a piece of Emacs Lisp code?
There are a number of ways to execute (called "evaluate") an Emacs Lisp
"form":
* If you want it evaluated every time you run Emacs, put it in a file
named `.emacs' in your home directory.
* You can type the form in the *scratch* buffer, and then type LFD (or
C-j) after it. The result of evaluating the form will be inserted in
the buffer.
* In Emacs-Lisp mode, typing M-C-x evaluates a top-level form before or
around point.
* Typing "C-x C-e" in any buffer evaluates the Lisp form immediately
before point and prints its value in the echo area.
* Typing M-ESC or M-x eval-expression allows you to type a Lisp form in
the minibuffer which will be evaluated.
* You can use M-x load-file to have Emacs evaluate all the Lisp forms in
a file. (To do this from Lisp use the function `load' instead.)
These functions are also used for evaluating Lisp forms:
load-library, eval-region, eval-current-buffer, require, autoload
54: How do I change Emacs's idea of the tab character's length?
Example: (setq default-tab-width 10).
55: How do I insert `>' at the beginning of every line?
Type "M-x replace-regexp RET ^ RET > RET".
To do this only in the region, type "C-x n M-x replace-regexp RET ^ RET
> RET C-x w".
WARNING: The command narrow-to-region (C-x n) is disabled by default
because it can be very confusing (ie., "Oh no! Where did my file go?").
56: How do I insert `_^H' before each character in a paragraph to get an
underlined paragraph?
M-x underline-region.
57: How do I repeat a command as many times as possible?
Use "C-x (" and "C-x )" to make a keyboard macro that invokes the command
and then type "M-0 C-x e".
WARNING: any messages your command prints in the echo area will be
suppressed.
58: How do I make Emacs behave like this: when I go up or down, the cursor
should stay in the same column even if the line is too short?
M-x picture-mode. (This is a minor mode, in theory anyway ...)
59: How do I tell Emacs to iconify itself?
You need to modify C source and recompile. Either that or get Epoch or
Lucid Emacs instead. Patches have been written by Robert Forsman
<thoth@reef.cis.ufl.edu> and Johan Vromans <jv@mh.nl> to allow Emacs to
iconify itself and by Matt Wette <mwette@mr-ed.jpl.nasa.gov> and
Manavendra K. Thakur <thakur@zerkalo.harvard.edu> (for 18.57, plus icon
geometry) to allow Emacs to start up iconified. I don't know which of
these patches work together.
Anonymous FTP:
/csi.jpl.nasa.gov:pub/emacs.patch1 (Matt Wette) +
/ftp.eu.net:gnu/emacs/FP-Xfun.Z (Johan Vromans) +
/ftp.urc.tue.nl:pub/tex/emacs/FP-Xfun (Johan Vromans) +
60: How do I use regexps (regular expressions) in Emacs?
See `Regexps' in the online manual.
WARNING: The "or" operator is `\|', not `|', and the grouping operators
are `\(' and `\)'. Also, the string syntax for a backslash is "\\".
Thus, the string syntax for a regular expression like xxx\(foo\|bar\) is
"xxx\\(foo\\|bar\\)". Notice the duplicated backslashes!
WARNING: Unlike in Unix grep, sed, etc., a complement character set
([^...]) can match a newline character (LFD aka C-j aka \n), unless
newline is mentioned as one of the characters not to match.
WARNING: The character syntax regexps (eg. `\sw') are not meaningful
inside character set regexps (eg. `[aeiou]'). (This is actually typical
for regexp syntax.)
61: How do I perform a replace operation across more than one file?
The "tags" feature of Emacs includes the command tags-query-replace which
performs a query-replace across all the files mentioned in the TAGS file.
See `Tags:Tags Search' in the online manual.
In addition, Martin Boyer has written a package named global-replace which
will perform a query-replace across all the files mentioned in the
*compilation* buffer (usually done after a `grep'), which is available via
anonymous FTP: !
!
/ireq-robot.hydro.qc.ca:pub/emacs/lisp/compile.el.Z !
/ireq-robot.hydro.qc.ca:pub/emacs/lisp/global-replace.el.Z !
/ireq-robot.hydro.qc.ca:pub/emacs/lisp/query.el.Z !
62: Where is the documentation for `etags'?
`etags' takes options just like a prior version of ctags, so your ctags
manual (if any) may be useful. {Can someone send me the details on this?}
Bugs/Problems
63: Does Emacs have problems with files larger than 8 megabytes?
Most installed versions of GNU Emacs will use 24-bit signed integers (and
24-bit pointers) internally. This limits the file size that Emacs can
handle to 8,388,607 bytes (2^23 - 1).
Leonard N. Zubkoff <lnz@lucid.com> suggests putting the following two
lines in src/config.h before compiling Emacs to allow for 26-bit integers
and pointers (and thus filesizes of up to 33,554,431 bytes):
#define VALBITS 26
#define GCTYPEBITS 5
WARNING: This method may result in `ILLEGAL DATATYPE' and other random
errors on some machines.
David Gillespie <daveg@csvax.cs.caltech.edu> gives an explanation of why
Emacs uses 24 bit integers and pointers:
Emacs is largely written in a dialect of Lisp; Lisp is a freely-typed
language in the sense that you can put any value of any type into any
variable, or return it from a function, and so on. So each value must
carry a "tag" along with it identifying what kind of thing it is, eg.,
integer, pointer to a list, pointer to an editing buffer, and so on.
Emacs uses standard 32-bit integers for data objects, taking the top 8
bits for the tag and the bottom 24 bits for the value. So integers (and
pointers) are somewhat restricted compared to true C integers and
pointers.
Emacs uses 8-bit tags because that's a little faster on byte-oriented
machines, but there are only really enough tags to require 6 bits.
64: Why can't Emacs find files in current directory on startup?
Most likely, you have an environment variable named PWD that is set to a
value other than the name of your current directory. This is most
likely caused by using two different shell programs. `ksh' and (some
versions of) `csh' set and maintain the value of the PWD environment
variable, but `sh' doesn't. If you start sh from ksh, change your
current directory inside sh, and then start Emacs from inside sh, PWD
will have the wrong value but Emacs will use this value. See the
etc/OPTIONS file for more details.
Perhaps an easier solution is not to use two shells. The `chsh' program
can often be used to change one's default login shell.
You may have PWD set for other reasons. Another possibility is that you
are setting default-directory from your .emacs file.
Here is a fix by Jim Blandy <jimb@occs.cs.oberlin.edu>:
>--- emacs/jjj/emacs-18.58/lisp/startup.el Tue Jan 15 23:19:04 1991
>+++ startup.el Mon Apr 20 00:21:01 1992
>@@ -81,5 +81,7 @@
> ;; In presence of symlinks, switch to cleaner form of default directory.
> (if (and (not (eq system-type 'vax-vms))
>- (getenv "PWD"))
>+ (getenv "PWD")
>+ (equal (nthcdr 10 (file-attributes default-directory))
>+ (nthcdr 10 (file-attributes (getenv "PWD")))))
> (setq default-directory (file-name-as-directory (getenv "PWD"))))
> (unwind-protect